var app = angular.module('conversionTool', []);

app.controller('projectDetailCtrl', [ '$scope', '$http', function($scope, $http) {

	$scope.project = new Object();

	$scope.operations = new Object();

	$scope.getOperations = function() {
		$http.post('/rest/project/getOperationsByProjectId', $scope.project).success(function(data) {

			$scope.operations = data;

		}).error(function(data) {
			console.log(data);
		});
	}

	$scope.getOperations();

	$scope.deleteOperation = function(id) {

		$http.post('/rest/project/deleteOperation', id).success(function(data) {

			if (data == true) {
				$scope.getOperations();
				$scope.msg="delete success.";
			} else {
				$scope.msg="server error";
			}

		}).error(function(data) {
			console.log(data);
		});
	}
	
	
	$scope.viewOperation=function(id){
		document.getElementById("OperationId").value=id;
		
	}
	

} ]);